<?php
include("../dynamicContent.php");
autorizacionCMS();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>KVM Page - Administrator</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<link href="default.css" rel="stylesheet" type="text/css" media="all" />
        <script type="text/javascript">
	
function confirmarB()
		{
		var agree=confirm("It'll be inserted a phrase");
		if (agree){
			return true ;
			}
		else
			return false ;
		}	

//busca caracteres que no sean espacio en blanco en una cadena
function vacio(q) {
        for ( i = 0; i < q.length; i++ ) {
                if ( q.charAt(i) != " " ) {
                        return true
                }
        }
        return false
}

//valida que el campo no este vacio y no tenga solo espacios en blanco
function valida(F) {
	var error = 0;

        	if( vacio(document.getElementById('titulo').value) == false ) {
			document.getElementById("ID_Label"+1).innerHTML = "You must fill all form";
			error = error + 1;              
        	} 
			else {              
			document.getElementById("ID_Label"+1).innerHTML = "";
			}
			if( vacio(document.getElementById('descripcion').value) == false ) {
			document.getElementById("ID_Label"+5).innerHTML = "You must fill all form";
			error = error + 1;              
        	} 
			else {              
			document.getElementById("ID_Label"+5).innerHTML = "";
			}
			
			if (error == 0 )
			return true;
			else
			return false;      
}

</script>
        
	</head>
	
	<body>

		<div id="wrapper">
		
			<div id="logo">						
				<?php tituloSubtituloCMS();  ?>
			</div>
			
			<div id="page" class="round">
			
			
			
				
				<div id="wrapper2" class="round">
				
					<div id="sidebar" class="round">
					<?php sidebarCMS();  ?>
					<!-- End Sidebar -->				
					</div>
					
					<div id="content" class="round">
						<h1>Insert Phrase</h1>
    <center>




    <form method="post" action='ins.php?tipo=2&red=fraseInsertar.php'>
<br />
	<label>Title</label>
    <br />
    <input id="titulo" class="camposTexto" type="text" name = "titulo" />
    <label id="ID_Label1" style="color:#C03"></label>
    <br />
	<br />
    <label>Category</label>
    <br />
    <select name="categoria" id="categoria">
<?php  cargarCategoriasFrases(); ?>
    </select>
    <label id="ID_Label3" style="color:#C03"></label>
    <br />
	<br />
    <label>Content</label>
    <br />
    <textarea id="descripcion" class="areaTexto" name= "descripcion"></textarea>
    <label id="ID_Label5" style="color:#C03"></label>
    <br />
	<br />
    <input class="botones" type="button" value="Insert Phrase" onclick="if (valida()){
    if( confirmarB()) this.form.submit(); }" />

    
    
    </form>
    
 
 </center>
					
					<!-- End Content -->
					</div>
			
					<div style="clear: both"></div>
			
				<!-- End Wrapper 2 -->
				</div>
				
			<!-- End Page -->
			</div>
		
		<!-- End Wrapper -->
		</div>
		
		<div id="footer">
			<?php  piePagina();  ?>
		</div>
		
		
	</body>
	
</html>
